home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Object = "{22D6F304-B0F6-11D0-94AB-0080C74C7E95}#1.0#0"; "MSDXM.OCX" Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Object = "{B0E4B491-7E7B-11D0-8E50-444553540000}#4.0#0"; "ICONTRAY.OCX" Begin VB.Form frmMain Caption = "MP3 Player" ClientHeight = 4605 ClientLeft = 165 ClientTop = 735 ClientWidth = 3855 Icon = "frmMain.frx":0000 LinkTopic = "Form1" ScaleHeight = 307 ScaleMode = 3 'Pixel ScaleWidth = 257 StartUpPosition = 3 'Windows Default Begin IconTrayOCX.IconTray IconTray1 Left = 1455 Top = 4215 _ExtentX = 688 _ExtentY = 741 End Begin VB.OptionButton Option1 Caption = "&None" Height = 195 Left = 3180 TabIndex = 14 Top = 4065 Value = -1 'True Width = 735 End Begin VB.CommandButton cmdCd Caption = "Open CD ROM" BeginProperty Font Name = "Arial" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 735 Left = 2880 TabIndex = 12 Top = 2940 Width = 735 End Begin VB.CommandButton cmdSys Caption = "Show in Sys Tray" Height = 285 Left = 30 TabIndex = 10 Top = 4020 Width = 1455 End Begin VB.OptionButton optRnd Caption = "Random" Height = 255 Left = 2265 TabIndex = 9 Top = 4035 Width = 975 End Begin VB.OptionButton chkOrd Caption = "Order" Height = 255 Left = 1590 TabIndex = 8 Top = 4035 Width = 975 End Begin VB.CommandButton cmdRes Caption = "Resume" Enabled = 0 'False Height = 375 Left = 2880 TabIndex = 7 Top = 2460 Width = 735 End Begin VB.CommandButton cmdPause Caption = "Pause" Height = 375 Left = 2880 TabIndex = 6 Top = 1980 Width = 735 End Begin MSComctlLib.Slider Slider1 Height = 255 Left = 45 TabIndex = 5 Top = 660 Width = 3645 _ExtentX = 6429 _ExtentY = 450 _Version = 393216 End Begin VB.Timer Timer1 Left = 360 Top = 4260 End Begin VB.CommandButton cmdStop Caption = "Stop" Height = 375 Left = 2880 TabIndex = 4 Top = 1500 Width = 735 End Begin VB.CommandButton cmdPlay Caption = "Play" Enabled = 0 'False Height = 375 Left = 2880 TabIndex = 3 Top = 1020 Width = 735 End Begin VB.FileListBox File1 Height = 2625 Left = 75 Pattern = "*.mp3" TabIndex = 2 Top = 1005 Width = 2655 End Begin MSComDlg.CommonDialog Dialog Left = 1920 Top = 4080 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.Label Label1 BorderStyle = 1 'Fixed Single Caption = "Song" Height = 255 Left = 120 TabIndex = 1 Top = 120 Width = 3495 End Begin VB.Label lblPath AutoSize = -1 'True BorderStyle = 1 'Fixed Single Height = 255 Left = 120 TabIndex = 11 Top = 3735 Width = 105 End Begin MediaPlayerCtl.MediaPlayer MP3Player Height = 375 Left = 945 TabIndex = 0 Top = 4200 Visible = 0 'False Width = 495 AudioStream = -1 AutoSize = 0 'False AutoStart = -1 'True AnimationAtStart= -1 'True AllowScan = -1 'True AllowChangeDisplaySize= -1 'True AutoRewind = 0 'False Balance = 0 BaseURL = "" BufferingTime = 3 CaptioningID = "" ClickToPlay = -1 'True CursorType = 0 CurrentPosition = -1 CurrentMarker = 0 DefaultFrame = "" DisplayBackColor= 0 DisplayForeColor= 16777215 DisplayMode = 0 DisplaySize = 4 Enabled = -1 'True EnableContextMenu= -1 'True EnablePositionControls= -1 'True EnableFullScreenControls= 0 'False EnableTracker = -1 'True Filename = "" InvokeURLs = 0 'False Language = -1 Mute = 0 'False PlayCount = 0 PreviewMode = 0 'False Rate = 1 SAMILang = "" SAMIStyle = "" SAMIFileName = "" SelectionStart = -1 SelectionEnd = -1 SendOpenStateChangeEvents= -1 'True SendWarningEvents= -1 'True SendErrorEvents = -1 'True SendKeyboardEvents= 0 'False SendMouseClickEvents= 0 'False SendMouseMoveEvents= 0 'False SendPlayStateChangeEvents= -1 'True ShowCaptioning = 0 'False ShowControls = -1 'True ShowAudioControls= -1 'True ShowDisplay = 0 'False ShowGotoBar = 0 'False ShowPositionControls= -1 'True ShowStatusBar = 0 'False ShowTracker = -1 'True TransparentAtStart= 0 'False VideoBorderWidth= 0 VideoBorderColor= 0 VideoBorder3D = 0 'False Volume = 0 WindowlessVideo = 0 'False End Begin VB.Label lblTotal AutoSize = -1 'True BorderStyle = 1 'Fixed Single Caption = "Total number of mp3's:" Height = 255 Left = 120 TabIndex = 13 Top = 360 Width = 1665 End Begin VB.Menu mnufolder Caption = "&Folder of mp3's" End Begin VB.Menu mnuAbout Caption = "&About" End Begin VB.Menu mnuOptions Caption = "&Options" Visible = 0 'False Begin VB.Menu mnuShow Caption = "&Show Mp3 Player" End Begin VB.Menu dash Caption = "-" End Begin VB.Menu mnuEnd Caption = "&End Mp3PLayer" End End Attribute VB_Name = "frmMain" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Private Sub chkOrd_Click() On Error Resume Next File1.ListIndex = 0 If chkOrd.Value = True Then cmdPlay.Enabled = True optRnd.Value = False 'File1.ListIndex = 1 MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName End If End Sub Private Sub cmdCd_Click() If cmdCd.Caption = "Open CD ROM" Then cmdCd.Caption = "Close CD ROM" mciSendString "Set CDAudio Door Open Wait", _ 0&, 0&, 0& ElseIf cmdCd.Caption = "Close CD ROM" Then cmdCd.Caption = "Open CD ROM" mciSendString "Set CDAudio Door Closed Wait", _ 0&, 0&, 0& End If End Sub Private Sub cmdPause_Click() On Error Resume Next MP3Player.Pause cmdPause.Enabled = False cmdRes.Enabled = True End Sub Private Sub cmdPlay_Click() On Error Resume Next Dim MyValue Dim Total As Integer If optRnd.Value = True Then MyValue = Int((File1.ListCount * Rnd)) File1.ListIndex = MyValue MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName End If If chkOrd.Value = True Then Total = File1.ListCount 'File1.ListIndex = File1.ListIndex + 1 MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName End If End Sub Private Sub cmdRes_Click() On Error Resume Next MP3Player.Play MP3Player.CurrentPosition = Slider1.Value cmdRes.Enabled = False cmdPause.Enabled = True End Sub Private Sub cmdStop_Click() Slider1.Value = 0 Timer1.Interval = 0 MP3Player.CurrentPosition = 0 MP3Player.Stop Label1.Caption = File1.Path & "\" & File1.FileName cmdRes.Enabled = False End Sub Private Sub cmdSys_Click() IconTray1.Icon = frmMain.Icon IconTray1.ToolTip = "MP3 Player" IconTray1.Add cmdSys.Enabled = False Me.Visible = False End Sub Private Sub Command1_Click() End Sub Private Sub File1_Click() cmdPlay.Enabled = True Label1.Caption = File1.Path & "\" & File1.FileName End Sub Private Sub Form_Load() On Error Resume Next 'chkOrd.Value = True ChDir App.Path Open App.Path & "\" & "default.Dat" For Input Access Read As #1 Input #1, Ddefault File1.Path = Ddefault lblPath.Caption = Ddefault MP3Player.BaseURL = Ddefault lblTotal.Caption = "Total number of mp3's: " & File1.ListCount Close #1 End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) IconTray1.Remove Open App.Path & "\" & "default.Dat" For Input Access Read As #1 Close #1 End Sub Private Sub HScroll1_Scroll() MP3Player.CurrentPosition = HScroll1.Value End Sub Private Sub IconTray1_LeftDblClick() frmMain.Show IconTray1.Remove cmdSys.Enabled = True End Sub Private Sub IconTray1_RightClick() PopupMenu mnuOptions End Sub Private Sub mnuAbout_Click() frmAbout.Show End Sub Private Sub mnuEnd_Click() IconTray1.Remove End Sub Private Sub mnufolder_Click() Me.Visible = False frmfolder.Show End Sub Private Sub mnuShow_Click() frmMain.Show IconTray1.Remove cmdSys.Enabled = True End Sub Private Sub MP3Player_EndOfStream(ByVal Result As Long) 'File1.ListIndex = 1 Dim MyValue If optRnd.Value = True And MP3Player.CurrentPosition = MP3Player.Duration Then MyValue = Int((File1.ListCount * Rnd)) File1.ListIndex = MyValue MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName End If If chkOrd.Value = True Then Total = File1.ListCount File1.ListIndex = File1.ListIndex + 1 MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName End If End Sub Private Sub MP3Player_Error() 'MsgBox "An error has occured to mp3Player" End Sub Private Sub Option1_Click() If chkOrd.Value = 1 Then cmdPlay.Enabled = True File1.ListIndex = 0 optRnd.Value = 0 MP3Player.FileName = File1.Path & "\" & File1.FileName MP3Player.Play Slider1.Max = MP3Player.Duration Timer1.Interval = 1 Label1.Caption = MP3Player.FileName End If End Sub Private Sub optRnd_Click() On Error Resume Next cmdPlay.Enabled = True chkOrd.Value = False End Sub Private Sub Slider1_Scroll() MP3Player.CurrentPosition = Slider1.Value End Sub Private Sub SystemTray1_IconAdded() SystemTray1.Action = sys_modify End Sub Private Sub SystemTray1_IconDeleted() SystemTray1.Action = sys_modify End Sub Private Sub SystemTray1_MouseDblClk(ByVal Button As Integer) SystemTray1.Action = sys_delete SystemTray1.Action = sys_modify frmMain.Visible = True cmdSys.Enabled = True End Sub Private Sub SystemTray1_MouseMove() SystemTray1.SysTrayText = "mp3 Player" SystemTray1.Action = sys_modify End Sub Private Sub Timer1_Timer() Slider1.Value = MP3Player.CurrentPosition End Sub